Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SSL termination to the explorer #1586

Merged
merged 5 commits into from
Dec 16, 2024
Merged

Add SSL termination to the explorer #1586

merged 5 commits into from
Dec 16, 2024

Conversation

klaus993
Copy link
Collaborator

@klaus993 klaus993 commented Dec 6, 2024

Add SSL termination to the explorer

Description

Manage SSL termination directly from the explorer, to remove the reverse-proxy dependency (caddy)

Changes

  • explorer/lib/explorer_web/router.ex: make CSP less strict for the website to be able to:
    • 'unsafe-inline': execute JS scripts inline
    • img-src https://w3.org blob: data:;: fetch some image/data from w3
  • explorer/config/runtime.exs: handle SSL certificates from elixir endpoint
    • PORT_SSL env var sets the port for HTTPS endpoint to listen on, not needed as it's defaulted to 443
      • for the 443 binding to work, it's needed to either:
        • run the release with sudo (not recommended for security reasons)
        • add capabilities to the BEAM binary to bind to low ports, for example in staging: sudo setcap CAP_NET_BIND_SERVICE=+eip /home/app/repos/explorer/aligned_layer/explorer/_build/prod/rel/explorer/erts-14.2.1/bin/beam.smp
    • KEYFILE_PATH and CERTFILE_PATH are the local paths to the SSL private key and the certificate, if not set, HTTP endpoint will be brought up, but not HTTPS one
    • NOTE: as this config is all inside the if config_env() == :prod, local development setup changes are not needed

@klaus993 klaus993 changed the base branch from staging to testnet December 6, 2024 14:35
@samoht9277 samoht9277 self-requested a review December 10, 2024 15:39
JuArce

This comment was marked as outdated.

Copy link
Collaborator

@samoht9277 samoht9277 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as intended

@JuArce JuArce merged commit dc613d9 into testnet Dec 16, 2024
1 check passed
@JuArce JuArce deleted the explorer-ssl branch December 16, 2024 16:08
ilitteri added a commit to ilitteri/aligned_layer that referenced this pull request Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants